package br.com.lazyprogrammer.worldsoccermanager.localization.exception;

import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;

import br.com.lazyprogrammer.worldsoccermanager.R;

public class LocalizationTimeOutException extends GPSException {
	
	private static final long serialVersionUID = 4558029162530829386L;

	public LocalizationTimeOutException() {
		super();
	}

	public LocalizationTimeOutException(Context context, int messageResource) {
		super(context, messageResource);
	}

	public LocalizationTimeOutException(String detailMessage) {
		super(detailMessage);
	}

	@Override
	protected Builder buildDialog(final Context context, String message) {
		Builder alertDialogBuilder = new Builder(
				context);
		alertDialogBuilder
				.setMessage(message);
		alertDialogBuilder.setPositiveButton(context.getString(R.string.button_enable_gps), new DialogInterface.OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					Intent callGPSSettingIntent = new Intent(
							android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
					context.startActivity(callGPSSettingIntent);
				}
			});
		alertDialogBuilder.setNegativeButton(context.getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});
		return alertDialogBuilder;
	}


}
